package com.example.controller;

import com.example.util.UploadUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
@RestController
public class FileController
{
    @RequestMapping(value = "/upload")
    public String shareUpload(HttpServletRequest request) throws IOException
    {
        new UploadUtil(request);
        return "<h1>上传成功</h1>\n" +
                "<span id=\"return_time\">3</span>秒后返回\n" +
                "<script>\n" +
                "    setTimeout(function () {\n" +
                "        window.open(\"http://122.9.151.77:7070/home\",\"_self\")\n" +
                "    },3000)\n" +
                "    var return_time = document.getElementById(\"return_time\");\n" +
                "    var time = 2;\n" +
                "    setInterval(function () {\n" +
                "        return_time.innerText = time;\n" +
                "        time--;\n" +
                "    },1000)\n" +
                "</script>";
    }
}
